package com.test.utils;

import com.test.entity.RestBean;
import org.springframework.stereotype.Component;

import java.util.function.Supplier;

@Component
public class ControllerUtils {
    public <T> RestBean<T> handleMessage(Supplier<String> supplier) {
        String message = supplier.get();
        if(message == null)
            return RestBean.success();
        return RestBean.failure(400,message);

    }
}
